<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8"%>
<%@ page import="elibrary.*" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <link href="css/style.css" rel="stylesheet" type="text/css" />
        <title>My-Library | Install</title>
    </head>
    <body>
        <%
	
		
		
                String path = getServletContext().getRealPath("/config.jsp");
                Config conf = new Config();
                conf.readConfig(path);
                if(! conf.connectURL.equals("connectURL")){
                        response.sendRedirect("index.jsp");
                }
        %>
        <div id="installBox">
            <% if (session.getAttribute("message") != null) { %>
            <div id="msgbox">
                <%= session.getAttribute("message") %>
                <% session.setAttribute("message", null); %>
            </div>
            <%} %>
            <form action="installProcess.jsp" method="post">
                <p>This is a one time set up. Please make sure you enter the details properly.</p>
                <table>
                    <tr>
                        <td>Database Host:</td>
                        <td><input type="text" name="host"/></td>
                    </tr>
                    <tr>
                        <td>Database Port:</td>
                        <td><input type="text" name="port"/></td>
                    </tr>
                    <tr>
                        <td>Database Name: </td>
                        <td><input type="text" name="db"/></td>
                    </tr>
                    <tr>
                        <td>Database User: </td>
                        <td><input type="text" name="dbuser"/></td>
                    </tr>
                    <tr>
                        <td>Database Password: </td>
                        <td><input type="text" name="dbpass"/></td>
                    </tr>
                    <tr>
                        <td>Site email: </td>
                        <td><input type="text" name="email"/></td>
                    </tr>
                    <tr>
                        <td></td>
                        <td><input type="submit" value="Submit"></td>
                    </tr>
                </table>
            </form>
        </div>
    </body>
</html>